package com.huaxin.hxmoduleworkorder.feignclients.impl;

import com.huaxin.feignclient.file.FileClient;
import com.huaxin.feignclient.file.models.UploadFIleRespDTO;
import com.huaxin.feignclient.models.ResponseCode;
import com.huaxin.feignclient.models.ResponseResult;
import com.huaxin.feignclient.file.models.Base64ImageUploadReqDTO;
import com.huaxin.hxmoduleworkorder.feignclients.FileFeignService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class FileFeignServiceImpl implements FileFeignService {
    private final FileClient fileClient;

    @Override
    public UploadFIleRespDTO uploadBase64Image(Base64ImageUploadReqDTO dto) {
        ResponseResult<UploadFIleRespDTO> result = fileClient.uploadBase64Image(dto);
        if (result.getCode() != ResponseCode.SUCCESS.getCode()) {
            return null;
        }
        return result.getData();
    }
}
